<template>
	<view class="contain ">
		<!-- #ifndef MP-TOUTIAO -->
		<!-- <view @click="back(1)" :style="'top:'+getStorage('top')+'px'" class="flex f-a-c f-j-c van-icon van-icon-arrow-left back-btn f20-size"></view>
		<view style="padding-top: 50px;"></view> -->
		<!-- #endif -->
		<view class="f30-size t-color-w flex f-j-c f-w-500 title">[ {{info.physique_name}}]</view>
		
		<view class="b-radius-5 padding-10 desc bg-shadow-0">
			 {{info.physique_analysis}}
		</view>
		
		<view class="padding-lr12">
			
			<view  class="item bg-shadow-0 margin-b20">
				<view class="f18-size f-w-b"> 异常分析</view>
				<view  class="f16-size f-w-b margin-t16"> 您有{{yichangList.length}} 项异常</view>
				<block v-for="(item,index) in yichangList" :key="index">
					<view class="f-w-500 margin-t16">【{{item.feature_group}}】</view>
					<view class="f12-size t-color-9 margin-t10">
						{{item.feature_interpret}}
					</view>
				</block>
			</view>
			
			<view  class="item bg-shadow-0 margin-b20">
				<view class="f18-size f-w-b"> 典型症状</view>
				<view class="f12-size t-color-9 margin-t10">
					{{info.typical_symptom}}
				</view>
			</view>
			
			<view  class="item bg-shadow-0 margin-b20">
				<view class="f18-size f-w-b">诊断</view>
				<view class="f-w-500 margin-t16">【中医证型】</view>
				<view class="f12-size t-color-9 margin-t10">
					{{info.syndrome_name}}
				</view>
				<view class="f-w-500 margin-t16">【证型说明】</view>
				<view class="f12-size t-color-9 margin-t10">
					{{info.syndrome_introduction}}
				</view>	
			</view>
			
			<view  class="item bg-shadow-0 margin-b20">
				<view class="f18-size f-w-b"> 身体风险</view>
				<view class="f12-size t-color-9 margin-t10">
					{{info.risk_warning}}
				</view>
			</view>
			
			<view  class="item bg-shadow-0 margin-b20">
				<view class="f18-size f-w-b">生活调理方案</view>
				<view  class="f16-size f-w-b margin-t16">饮食调养</view>
				<block v-for="(item,index) in info.advices.food" :key="index">
					<view class="f-w-500 margin-t16">【{{item.title}}】</view>
					<view class="f12-size t-color-9 margin-t10">
						{{item.advice}}
					</view>
				</block>
				<view  class="f16-size f-w-b margin-t16">音乐调养</view>
				<block v-for="(item,index) in info.advices.music" :key="index">
					<view class="f-w-500 margin-t16">【{{item.title}}】</view>
					<view class="f12-size t-color-9 margin-t10">
						{{item.advice}}
					</view>
				</block>
				<view  class="f16-size f-w-b margin-t16">运动调养</view>
				<block v-for="(item,index) in info.advices.sport" :key="index">
					<view class="f-w-500 margin-t16">【{{item.title}}】</view>
					<view class="f12-size t-color-9 margin-t10">
						{{item.advice}}
					</view>
				</block>
				<view  class="f16-size f-w-b margin-t16">起居建议</view>
				<block v-for="(item,index) in info.advices.sleep" :key="index">
					<view class="f-w-500 margin-t16">【{{item.title}}】</view>
					<view class="f12-size t-color-9 margin-t10">
						{{item.advice}}
					</view>
				</block>
				<view  class="f16-size f-w-b margin-t16">外治建议</view>
				<block v-for="(item,index) in info.advices.treatment" :key="index">
					<view class="f-w-500 margin-t16">【{{item.title}}】</view>
					<view class="f12-size t-color-9 margin-t10">
						{{item.advice}}
					</view>
				</block>
			</view>
			
			
			<view class="f12-size t-color-9"> 本报告分析结果，仅供参考，不可作为医疗诊断结论，如身体不适，请及时资讯医师。</view>
		</view>
		
		
	</view>
</template>
<style scoped>
	@import url("@/static/css/index/index.css");
</style>
<script>
	const $ = require('@/utils/api.js');
	let self = this;
	let timer;
	export default {
		components: {},
		data() {
			return {
				info: '',
				yichangList: [],
				id: '',
			};
		},
		onLoad: function(options) {
			self = this;
			self.id = options.order_no ? options.order_no : '';
			this.init();
		},
		onShow() {
		},
		methods: {
			getInfo(){
				const self = this;
				uni.showLoading({
					title:'报告分析中…'
				})
				const param = uni.getStorageSync('qsData') ? uni.getStorageSync('qsData') : {};
				$.ajax({
					url: 'oneyuan/index/getReport',
					data: param,
					method: 'POST',
					loadingText: ' 报告分析中…',
					showLoading: true,
					success(res) {
						uni.hideLoading();
						const data = res.data ? res.data : '';
						self.info = data;
						self.yichangList = data.features.filter(ele => ele.feature_situation != '正常')
					}
				})
			},
			isPay() {
				const self = this;
				$.ajax({
					url: 'bingdouyanzhidypay/index/getOrderPayment',
					data: {out_order_no: this.id},
					method: 'POST',
					success(res) {
						self.getInfo();
					},
					error() {
						timer = setTimeout(() => {
							self.isPay();
						},2000)
					}
				})
			},
			init() {
				this.isPay();
				// this.getInfo();
			},
		},
		computed: {},
		created() {
		},
		mounted() {},
		destroyed() {
			try{
				clearTimeout(timer);
			}catch(e){
				//TODO handle the exception
			}
		},
		onPullDownRefresh() {
		},
		onReachBottom() {
			
		}
	}
</script>